package com.leetroll.api.mapper;

import com.leetroll.common.entity.Comment;
import com.leetroll.common.vo.CommentVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 管理员表 Mapper 接口
 */
public interface CommentMapper extends SuperMapper<Comment> {
    @Select("select b.name as user_name, b.avatar as user_avatar,a.* from (\n" +
            "\tSELECT * FROM public.comment " +
            "where resc_type=#{rescType} and resc_id=#{rescId}\n" +
            ") as a left join public.user b\n" +
            "on a.user_id = b.id order by a.create_time")
    List<CommentVO> list(@Param("rescType") String rescType,
                         @Param("rescId") Long rescId,
                         @Param("pageNumber") Integer pageNumber,
                         @Param("pageSize") Integer pageSize);
}
